public class Add {
    public static int Solution(int num1, int num2) {
        if (num1 != 0) {
            return Solution((num1 & num2) << 1, num1 ^ num2);
        } else
            return num2;
    }

    public static void main(String[] args) {
        int a = 1;
        int b = 2;
        System.out.println(Solution(a, b));
    }
}